﻿using System;
using System.Collections;
using System.Data;
using CE.Database;

/// <summary>
/// Summary description for UserTypeDB
/// </summary>
/// 
namespace CE.Provider
{
    public class UserTypeDB
    {
        public UserTypeDB()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        public Int64 Insert(UserType usertype)
        {
            MyDatabase _db = new MyDatabase();
            Int64 _result = -1;
            string _spName = "[sprocProviderUserTypeInsertUpdateSingleItem]";

            SortedList _sPara = new SortedList();

            #region Parameter
            _sPara.Add("@ProviderCompanyId", usertype.ProviderCompanyId);
            _sPara.Add("@CEID", usertype.CEID);
            _sPara.Add("@ProviderUserTypeId", usertype.ProviderUserTypeId);
            _sPara.Add("@Status", usertype.Status);
            _sPara.Add("@RefCEUserId", usertype.RefCEUserId);
            #endregion

            _result = _db.ExecuteSP(_spName, _sPara);

            return _result;
        }

        public DataTable GetProviderUserTypeList(Int64 ProviderCompanyId)
        {
            DataTable _usertypelist = new DataTable();
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocProviderUserTypeSelectItemList";

            SortedList _spara = new SortedList();
            _spara.Add("@ProviderCompanyId", ProviderCompanyId);

            _usertypelist = _db.GetDataTableBySP(_spName, _spara);

            return _usertypelist;
        }


        public DataTable GetProviderUserType(Int64 ProviderCompanyId, Int64 CEID)
        {
            DataTable _usertype = new DataTable();
            MyDatabase _db = new MyDatabase();
            string _spName = "sprocProviderUserTypeSelectSingleItem";

            SortedList _spara = new SortedList();
            _spara.Add("@ProviderCompanyId", ProviderCompanyId);
            _spara.Add("@CEID", CEID);

            _usertype = _db.GetDataTableBySP(_spName, _spara);

            return _usertype;
        }

    }
}